<template>
  <div class="error-page">
    <div class="error-content">
      <div class="error-image">
        <img src="@/assets/images/404.svg" alt="404" />
      </div>
      <div class="error-info">
        <h1 class="error-title">404</h1>
        <p class="error-subtitle">抱歉，您访问的页面不存在</p>
        <p class="error-description">
          可能是地址有误或该页面不存在。请检查您输入的网址，或返回首页。
        </p>
        <div class="error-actions">
          <el-button type="primary" @click="goHome">
            返回首页
          </el-button>
          <el-button @click="goBack">
            返回上页
          </el-button>
        </div>
      </div>
    </div>
  </div>
</template>

<script setup lang="ts">
import { useRouter } from 'vue-router'

const router = useRouter()

const goHome = () => {
  router.push('/')
}

const goBack = () => {
  history.back()
}
</script>

<style lang="scss" scoped>
.error-page {
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--kexilo-bg-color-page);
}

.error-content {
  display: flex;
  align-items: center;
  gap: 60px;
  max-width: 800px;
  margin: 0 auto;
  padding: 0 20px;
}

.error-image {
  img {
    width: 300px;
    height: auto;
  }
}

.error-info {
  flex: 1;
}

.error-title {
  font-size: 72px;
  font-weight: bold;
  color: var(--el-color-primary);
  margin: 0 0 16px;
  line-height: 1;
}

.error-subtitle {
  font-size: 24px;
  color: var(--kexilo-text-color-primary);
  margin: 0 0 16px;
}

.error-description {
  font-size: 16px;
  color: var(--kexilo-text-color-regular);
  margin: 0 0 32px;
  line-height: 1.6;
}

.error-actions {
  display: flex;
  gap: 16px;
}

@media (max-width: 768px) {
  .error-content {
    flex-direction: column;
    text-align: center;
    gap: 40px;
  }
  
  .error-image img {
    width: 200px;
  }
  
  .error-title {
    font-size: 48px;
  }
  
  .error-subtitle {
    font-size: 20px;
  }
  
  .error-actions {
    justify-content: center;
  }
}
</style>
